﻿using System.Collections.Generic;
using SuperSimpleWebshop.Domain;
using SuperSimpleWebshop.Domain.Interfaces;

namespace SuperSimpleWebshop.Payment.SagePay
{
    /// <summary>
    /// DLL naming must be: SuperSimpleWebshop.Payment.PaymentProviderName
    /// </summary>
    public class SagePayPaymentProvider : IPaymentProvider
    {
        #region IPaymentProvider Members
        public string ClassName { get; set; }

        /// <summary>
        /// Gets the payment provider name
        /// </summary>
        /// <returns>Name of the payment provider</returns>
        public string GetName()
        {
            return "SagePay";
        }

        public Common.PaymentParameterRenderMethod GetParameterRenderMethod()
        {
            return Common.PaymentParameterRenderMethod.Form;
        }

        #endregion

        #region IPaymentProvider Members
        public List<PaymentProviderMethod> GetAllPaymentMethods(string name)
        {
            var helper = new PaymentConfigHelper(name);

            var paymentMethods = helper.PaymentProviderMethods;

            foreach (var p in paymentMethods)
            {
                p.ProviderName = GetName();
                p.ProviderNodeName = name;
                p.Description = p.Name;
            }

            return paymentMethods;
        }
        #endregion
    }
}